package com.kaibes.web.admin;

import javax.servlet.http.HttpServletResponse;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.kaibes.web.api.ApiLink;
import com.kaibes.web.response.ResponseFactory;
import com.kaibes.web.util.WebUtils;

@RestController
@RequestMapping("/admins")
public class AdminApi {
    
    @PostMapping("/shutdown")
    @ApiLink("安全关闭网站")
    public ResponseEntity<Object> test(HttpServletResponse response) {
        try {
            return ResponseFactory.okMove("about:blank", "程序已被关闭，再见");
        } finally {
            WebUtils.shutDown();
        }
    }
    
}
